package com.asset.dispoal.file.replyDetail.domain.service.command;

import com.asset.dispoal.file.replyDetail.domain.db.mapper.FileReplyDetailMapper;
import com.asset.dispoal.file.replyDetail.dto.FileReplyMonthDetailStatistics;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import tech.mhuang.pacebox.core.ddd.BaseCommandNoParam;
import tech.mhuang.pacebox.springboot.protocol.Result;

@Component
public class FileReplyDetailMonthStatisticsCommand implements BaseCommandNoParam<Result<FileReplyMonthDetailStatistics>> {

    @Autowired
    private FileReplyDetailMapper fileReplyDetailMapper;

    @Override
    public Result<FileReplyMonthDetailStatistics> execute() {
        FileReplyMonthDetailStatistics monthDetailStatistics = new FileReplyMonthDetailStatistics();
        monthDetailStatistics.setDayAmount(fileReplyDetailMapper.getDaySumAmount());
        monthDetailStatistics.setWeekAmount(fileReplyDetailMapper.getWeekSumAmount());
        monthDetailStatistics.setMonthAmount(fileReplyDetailMapper.getMonthSumAmount());
        monthDetailStatistics.setBatchList(fileReplyDetailMapper.queryMonthBatchList());
        monthDetailStatistics.setChannelList(fileReplyDetailMapper.queryChannelList());
        return Result.ok(monthDetailStatistics);
    }
}
